/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.pod.hoteishilton.database;

import edu.pod.hoteishilton.dao.DAOHospede;
import edu.pod.hoteishilton.dao.DAOHotel;
import edu.pod.hoteishilton.dao.IDAOHospede;
import edu.pod.hoteishilton.dao.IDAOHotel;
import edu.pod.hoteishilton.model.Hospede;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

/**
 *
 * @author Tigaz
 */
public class DatabaseService extends UnicastRemoteObject implements DatabaseInterface {

    private static IDAOHospede daoHospede;
    private static IDAOHotel daoHotel;
    
    private Hospede h;

    public DatabaseService() throws RemoteException {
        if (daoHospede == null) {
            daoHospede = new DAOHospede();
        }

        if (daoHotel == null) {
            daoHotel = new DAOHotel();
        }
        
//        h = new Hospede("instanciado", null, null, null);

    }

    @Override
    public IDAOHospede getDaoHospede() throws RemoteException {
        return daoHospede;
    }

    @Override
    public void setDaoHospede(IDAOHospede daoHospede) throws RemoteException {
        DatabaseService.daoHospede = daoHospede;
    }

    public IDAOHotel getDaoHotel() throws RemoteException{
        return daoHotel;
    }

    public void setDaoHotel(IDAOHotel daoHotel) throws RemoteException{
        DatabaseService.daoHotel = daoHotel;
    }
    
    
    @Override
    public void sayHello() throws RemoteException {
        System.out.println("TESTEEEEEEE");
    }

    @Override
    public Hospede getH() throws RemoteException {
        return h;
    }

    @Override
    public void setH(Hospede h) throws RemoteException {
        this.h = h;
        System.out.println("o nome mudou para " + h.getNome());
    }
}
